home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / util / gnu / textutl3.lha / textutils-1.3 / configure < prev    next >
Text File  |  1992-06-29  |  9KB  |  321 lines

  1. :
  2. # Guess values for system-dependent variables and create Makefiles.
  3. # Generated automatically by autoconf.
  4. # Copyright (C) 1991 Free Software Foundation, Inc.
  5.  
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10.  
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. # GNU General Public License for more details.
  15.  
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [TARGET]
  21. # All args except --srcdir=DIR are ignored.
  22.  
  23. trap 'rm -f conftest conftest.c; exit 1' 1 3 15
  24.  
  25. set +u # Make sure unset variables are ok.
  26.  
  27. for arg in $*; do
  28.   # Handle --srcdir with a space before the argument.
  29.   if test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  30.   # Handle --host with a space before the argument.
  31.   elif test x$next_host = xyes; then next_host=
  32.   else
  33.     case $arg in
  34.      +srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  35.     srcdir=`echo $arg | sed 's/[+-]*s[a-z]*=//'` ;;
  36.      +srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  37.     next_srcdir=yes ;;
  38.      +host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  39.      +host | --host | --hos | --ho | --h)
  40.     next_host=yes ;;
  41.      +gas | --gas | --ga | --g) ;;
  42.      +nfp | --nfp | --nf | --n) ;;
  43.      *) ;;
  44.     esac
  45.   fi
  46. done
  47.  
  48. INCLUDEDIR=${INCLUDEDIR-/usr/include}
  49.  
  50. rm -f conftest conftest.c
  51. compile='$CC $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  52.  
  53. # A filename unique to this package, relative to the directory that
  54. # configure is in, which we can look for to find out if srcdir is correct.
  55. unique_file=src/fold.c
  56.  
  57. # Makefile rules whose targets are searched for in VPATH need to use $<.
  58. # However, old makes do not support it, so we use a combination
  59. # construction in Makefile.in: `$file<'.
  60. # If srcdir is `.', we use sed to change that to `file' for old makes.
  61. # Otherwise, we use sed to change it to `$<'.
  62. # vpsub is the sed program, which changes `$file<' to one or the other.
  63. vpsub='s,\$\([-./a-zA-Z0-9_]*\)<,\1,g'
  64. # srsub changes `@srcdir@' in Makefile.in into either `.' or the path
  65. # of the top of the source tree for the package.
  66. srsub='s,@srcdir@[-./a-zA_Z0-9_]*,.,'
  67.  
  68. # Find the source files, if location was not specified.
  69. if test x$srcdir = x; then
  70.   srcdirdefaulted=yes; srcdir=.
  71.   if test ! -r $unique_file; then srcdir=..; fi
  72. fi
  73. if test ! -r $srcdir/$unique_file; then
  74.   if test x$srcdirdefaulted = xyes; then
  75.     echo "configure: Can not find sources in \`.' or \`..'." 1>&2
  76.   else
  77.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  78.   fi
  79.   exit 1
  80. fi
  81. if test $srcdir != .; then
  82.   VPATH='VPATH = $(srcdir)'
  83.   case $srcdir in
  84.     /*|~*) ;;
  85.     *) srcdir=`pwd`/$srcdir ;; # Make relative path absolute.
  86.   esac
  87.   vpsub='s,\$\([-./a-zA-Z0-9_]*\)<,\$<,g'
  88.   srsub="s,@srcdir@,$srcdir,"
  89. fi
  90.  
  91.  
  92. # The Bourne shell writes "command not found" to /dev/tty, so if we get
  93. # a usage message on stderr, we have the program.
  94. #
  95. # ksh and zsh write "command not found" to stderr, but test -n does not
  96. # want any output if there is no program.  So we use the `type' builtin
  97. # instead for them (and bash).
  98. if test "$RANDOM" = "$RANDOM"; then
  99.   checkfor='test -n "`$checkprog $checkargs 2>&1`"'
  100. else
  101.   checkfor='type $checkprog >/dev/null'
  102. fi
  103.  
  104. echo checking for gcc
  105. checkprog=gcc checkargs=''
  106. test -z "$CC" && eval $checkfor && CC='gcc -O'
  107. CC=${CC-cc}
  108.  
  109. echo checking for install
  110. # Make sure to not get the incompatible SysV /etc/install.
  111. if test -z "$INSTALL" || test -z "$INSTALLDATA"; then
  112.   saveifs="$IFS"; IFS="$IFS:"
  113.   for dir in $PATH; do
  114.     test -z "$dir" && dir=.
  115.     if test $dir != /etc && test -f $dir/install; then
  116.       test -z "$INSTALL" && INSTALL="$dir/install -c"
  117.       test -z "$INSTALLDATA" && INSTALLDATA="$dir/install -c -m 644"
  118.       break
  119.     fi
  120.   done
  121.   IFS="$saveifs"
  122. fi
  123. INSTALL=${INSTALL-cp}
  124. INSTALLDATA=${INSTALLDATA-cp}
  125.  
  126. echo checking for ranlib
  127. checkprog=ranlib checkargs='/dev/null'
  128. test -z "$RANLIB" && eval $checkfor && RANLIB='ranlib '
  129. RANLIB=${RANLIB-true}
  130.  
  131. echo checking for POSIXized ISC
  132. if test -d /etc/conf/kconfig.d &&
  133.   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
  134. then
  135.   DEFS="$DEFS -D_POSIX_SOURCE"
  136.   case "$CC" in
  137.   gcc*) CC="$CC -posix" ;;
  138.   *) CC="$CC -Xp" ;;
  139.   esac
  140. fi
  141.  
  142. echo checking for signal handler type
  143. pattern='void[     ]*(\*signal[     ]*('
  144. if grep "$pattern" $INCLUDEDIR/signal.h >/dev/null 2>&1 ||
  145.   grep "$pattern" $INCLUDEDIR/sys/signal.h >/dev/null 2>&1; then :
  146. else DEFS="$DEFS -DSIGTYPE=int"
  147. fi
  148.  
  149. echo checking for ANSI C header files
  150. test -r $INCLUDEDIR/stdlib.h && test -r $INCLUDEDIR/string.h &&
  151.   test -r $INCLUDEDIR/limits.h && DEFS="$DEFS -DSTDC_HEADERS"
  152.  
  153. echo checking for unistd.h
  154. test -f $INCLUDEDIR/unistd.h && DEFS="$DEFS -DHAVE_UNISTD_H"
  155.  
  156. echo checking for BSD string and memory functions
  157. echo "#include <strings.h>
  158. main() { exit(0); } t() { rindex(0, 0); bzero(0, 0); }" > conftest.c
  159. eval $compile
  160. if test -s conftest && ./conftest 2>/dev/null; then :
  161. else
  162.   DEFS="$DEFS -DUSG"
  163. fi
  164. rm -f conftest conftest.c
  165.  
  166. echo checking for unsigned characters
  167. echo '
  168. #if !__STDC__
  169. #define volatile
  170. #endif
  171. main() { volatile char c = 255; exit(c < 0); }' > conftest.c
  172. eval $compile
  173. if test -s conftest && ./conftest 2>/dev/null; then
  174.   DEFS="$DEFS -D__CHAR_UNSIGNED__"
  175. fi
  176. rm -f conftest conftest.c
  177.  
  178. for func in bcopy memchr memcmp stpcpy
  179. do
  180. echo checking for $func
  181. echo "
  182. main() { exit(0); } t() { ${func}(); }" > conftest.c
  183. eval $compile
  184. if test -s conftest && ./conftest 2>/dev/null; then :
  185. else
  186.   LIBOBJS="$LIBOBJS ${func}.o"
  187. fi
  188. rm -f conftest conftest.c
  189.  
  190. done
  191.  
  192. for func in strerror
  193. do
  194. trfrom='[a-z]'; trto='[A-Z]'
  195. echo checking for $func
  196. echo "
  197. main() { exit(0); } t() { ${func}(); }" > conftest.c
  198. eval $compile
  199. if test -s conftest && ./conftest 2>/dev/null; then :
  200. else
  201.   DEFS="$DEFS -D`echo $func|tr "$trfrom" "$trto"`_MISSING"
  202. fi
  203. rm -f conftest conftest.c
  204.  
  205. done
  206.  
  207. echo checking for vprintf
  208. echo "
  209. main() { exit(0); } t() { vprintf(); }" > conftest.c
  210. eval $compile
  211. if test -s conftest && ./conftest 2>/dev/null; then :
  212. else
  213.   DEFS="$DEFS -DVPRINTF_MISSING"
  214. fi
  215. rm -f conftest conftest.c
  216.  
  217. case "$DEFS" in
  218. *VPRINTF_MISSING*)
  219. echo checking for _doprnt
  220. echo "
  221. main() { exit(0); } t() { _doprnt(); }" > conftest.c
  222. eval $compile
  223. if test -s conftest && ./conftest 2>/dev/null; then :
  224. else
  225.   DEFS="$DEFS -DDOPRNT_MISSING"
  226. fi
  227. rm -f conftest conftest.c
  228.  
  229. ;;
  230. esac
  231.  
  232. echo checking for alloca
  233. echo "#ifdef __GNUC__
  234. #define alloca __builtin_alloca
  235. #else
  236. #ifdef sparc
  237. #include <alloca.h>
  238. #else
  239. #ifdef _AIX
  240.  #pragma alloca
  241. #else
  242. char *alloca ();
  243. #endif
  244. #endif
  245. #endif
  246. main() { exit(0); } t() { char *p = (char *) alloca(1); }" > conftest.c
  247. eval $compile
  248. if test -s conftest && ./conftest 2>/dev/null; then :
  249. else
  250.   alloca_missing=1
  251. fi
  252. rm -f conftest conftest.c
  253.  
  254. if test -n "$alloca_missing"; then
  255.   if test -f /usr/ucblib/libucb.a
  256.   then LIBS="$LIBS -L/usr/ucblib -lucb" # SVR4
  257.   elif test -f /lib/libPW.a
  258.   then LIBS="$LIBS -lPW" # SVR2 and SVR3
  259.   else ALLOCA=alloca.o
  260.   fi
  261. fi
  262.  
  263. echo checking for st_blksize in struct stat
  264. echo "#include <sys/types.h>
  265. #include <sys/stat.h>
  266. main() { exit(0); } t() { struct stat s; s.st_blksize; }" > conftest.c
  267. eval $compile
  268. if test -s conftest && ./conftest 2>/dev/null; then :
  269. else
  270.   DEFS="$DEFS -DST_BLKSIZE_MISSING"
  271. fi
  272. rm -f conftest conftest.c
  273.  
  274. echo checking for Minix
  275. test -d /usr/include/minix &&
  276.   DEFS="$DEFS -D_POSIX_SOURCE" DEFS="$DEFS -D_POSIX_1_SOURCE=2" DEFS="$DEFS -D_MINIX"
  277.  
  278. echo checking for Xenix
  279. if test -f /xenix; then
  280.   DEFS="$DEFS -DVOID_CLOSEDIR"
  281.   LIBS="$LIBS -lx"
  282.   case "$DEFS" in
  283.   *SYSNDIR*) ;;
  284.   *) LIBS="-ldir $LIBS" ;; # Make sure -ldir precedes any -lx.
  285.   esac
  286. fi
  287.  
  288. trap 'for dir in . lib src man; do rm -f $dir/Makefile; done; rm -f config.status; exit 1' 1 3 15
  289.  
  290. for dir in . lib src man; do
  291.   test -d $dir || mkdir $dir
  292.   echo creating $dir/Makefile
  293.   echo '# Generated automatically from Makefile.in by configure.' > $dir/Makefile
  294.   sed -e "
  295. $vpsub
  296. $srsub
  297. s,@VPATH@,$VPATH,
  298. s,@DEFS@,$DEFS,
  299. s,@LIBS@,$LIBS,
  300. s,@CC@,$CC,
  301. s,@INSTALL@,$INSTALL,
  302. s,@INSTALLDATA@,$INSTALLDATA,
  303. s,@RANLIB@,$RANLIB,
  304. s,@LIBOBJS@,$LIBOBJS,
  305. s,@ALLOCA@,$ALLOCA,
  306. " $srcdir/$dir/Makefile.in >> $dir/Makefile
  307. done
  308.  
  309. echo creating config.status
  310. echo "\
  311. DEFS=\"$DEFS\"
  312. LIBS=\"$LIBS\"
  313. CC=\"$CC\"
  314. INSTALL=\"$INSTALL\"
  315. INSTALLDATA=\"$INSTALLDATA\"
  316. RANLIB=\"$RANLIB\"
  317. LIBOBJS=\"$LIBOBJS\"
  318. ALLOCA=\"$ALLOCA\"
  319. " > config.status
  320.  
  321.